# Convenient translator for use with ghex2
# Uses the standard grep inputs and returns the hex offset of those
#  entries that it found, then translates them into hex so that the
#  user can easily jump to it in ghex2

#!/bin/bash
for FOUND_OFFSET in `grep -abo $1 $2`
do
    if [[ ${FOUND_OFFSET} =~ ([0-9]+):[a-zA-Z]+ ]]
    then
	printf "%x\n" "${BASH_REMATCH[1]}"
    fi
done